<%@ page contentType="text/html;charset=UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="css/index.css">
    <link rel="stylesheet" type="text/css" href="font-awesome-4.7.0/css/font-awesome.min.css">
    <script type="text/javascript" src="jquery/jquery-3.5.1.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('.menux p').click(function () {
                $(this).siblings('ul').slideUp(200);
                $(this).next('ul').slideToggle(200);
            });
            $('.menux ul a').click(function () {
                $('iframe').attr("src", $(this).attr("url"));
            });
            $('.logout').click(function () {
                if (confirm("确定要退出吗？")) {
                    window.location.href = "logout";
                }
            })
        })
    </script>
</head>
<body>
<div class="header">

    <div class="logo"> fiction </div>
    <div class="user">
        <i class="fa fa-caret-down point"></i>
        <i class="fa fa-user"></i>
        <c:if test="${user_name == null}">
            个人中心
        </c:if>
        <c:if test="${user_name != null}">${user_name}</c:if>
        <ul>
<%--            <li><a href="testServlet?user_name=${user_name}" type="">修改个人信息</a></li>--%>
            <li><a href="javascript:void(0)" class="logout">退出登陆</a></li>
        </ul>
    </div>
</div>
<div class="left">
    <div class="title">
        <i class="fa fa-home"></i>
        系统功能
    </div>
    <div class="menux">
        <p>
            <i class="fa fa-info-circle"></i>
            <i class="fa fa-angle-right point"></i>
            小说
        </p>
        <ul>
            <li>
              <i class="fa fa-caret-right"></i>
                    <span id="test" onclick="btntest()"> 测试</span>
            </li>
            <li>
                    <i class="fa fa-caret-right"></i>
                    <span id="book" onclick="btnbook()"> 书城</span>
            </li>
        </ul>

      <c:if test="${powerlevel == 2}">
        <p>
            <i class="fa fa-info-circle"></i>
            <i class="fa fa-angle-right point"></i>
            作品
        </p>
        <ul>
            <li>
                <i class="fa fa-caret-right"></i>
                <span id="MYbook" onclick="mybook()">  我的作品</span>
            </li>

            </li>
            <li>
                <i class="fa fa-caret-right"></i>
                <span id="newbook" onclick="newbook()"> 发布新书</span>
            </li>
        </ul>
      </c:if>

      <c:if test="${powerlevel == 3}">

        <p>
            <i class="fa fa-info-circle"></i>
            <i class="fa fa-angle-right point"></i>
            管理
        </p>
        <ul>
            <li>
                <i class="fa fa-caret-right"></i>
                <span id="book_examine" onclick="book_examine()"> 书籍审核</span>
            </li>
            <li>
                <i class="fa fa-caret-right"></i>
                <span id="chapter_examine" onclick="chapter_examine()"> 章节审核</span>
            </li>
        </ul>
      </c:if>
    </div>
</div>
<div class="main">
    <iframe src="recommend.jsp" width="100%" height="98%" frameborder="0px" id="frame">

    </iframe>
</div>


</body>


<script type="text/javascript">

  function btntest() {
    frame.src = "test.jsp";
  }
  function btnbook() {
    frame.src = "search.jsp";
  }
  function mybook() {
      frame.src = "mybookServlet";
  }
  function newbook() {
      frame.src = "newbook.jsp";
  }
  function book_examine() {
      frame.src = "book_examineServlet";
  }
  function chapter_examine() {
      frame.src = "chapter_examineServlet";
  }
  </script>
</html>